Skip to content

docs: warn about infinite subagent recursion with global task permissions - #17724

Closed
coygeek wants to merge 1 commit into
anomalyco:devfrom
coygeek:docs-warn-subagent-recursion-risk
Closed

coygeek wants to merge 1 commit into
anomalyco:devfrom
coygeek:docs-warn-subagent-recursion-risk

Conversation

@coygeek

@coygeek coygeek commented Mar 16, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #17722

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adding "task": "allow" to the global permission block silently enables infinite subagent recursion. There's no depth limit — I hit 10 levels of nesting and 3+ hours of runaway token usage before noticing.

The root cause is in task.ts — the nesting guard checks for explicit task permission rules, and a global "task": "allow" propagates to all agents including subagents, overriding the guard. The default "*": "allow" does NOT trigger this, so users don't expect adding an explicit task key to have this effect.

This PR adds warnings to three docs pages:

  • agents.mdx: :::caution callout after the permission.task section showing safe vs unsafe patterns and explaining why steps/doom_loop don't help
  • permissions.mdx: Cross-reference on the task entry pointing to the agents doc warning
  • config.mdx: :::caution callout in the permissions section about global "task": "allow"

How did you verify your code works?

Read all three source files and confirmed the callout syntax (:::caution, :::tip) matches existing usage throughout the docs codebase. Changes are documentation-only with no code impact.

Screenshots / recordings

N/A — documentation-only change, no UI impact.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@rekram1-node

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Document infinite subagent recursion risk when permission.task is set globally

2 participants